public class Test03 {
    public static void main(String[] args) throws InterruptedException {
        Object locker1 = new Object();
        Object locker2 = new Object();
        //打印a
        Thread t1 = new Thread(() -> {
            System.out.print(Thread.currentThread().getName());
        }, "c");
        //打印b
        Thread t2 = new Thread(() -> {
            try {
                t1.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.print(Thread.currentThread().getName());
        }, "b");
        //打印c
        Thread t3 = new Thread(() -> {
            try {
                t2.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.print(Thread.currentThread().getName());
        }, "a");
        t1.start();
        t2.start();
        t3.start();
    }
}

